<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
 * @license    GNU/GPL
 */
 
// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport('joomla.application.component.controller');
 
/**
 * SummerCamps Component Controller
 * This is our base controller.
 *
 * @package    Joomla.Tutorials
 * @subpackage Components
 */
class SummerCampsControllerSingle extends JController
{
    /**
     * Method to display the view
     * Reacts to the user action of requesting a page view, and 
     * calls the display function to display the data. 
     *
     * @access    public
     */
    function display()
    {
    	JRequest::setVar('view', 'single');
    	$view =& $this->getView('single', 'html');
    	$view->setModel($this->getModel('single'));
        parent::display(); //calls display in site/views/single/view.html.php?
    }
    
	/**
	 * save a record (and redirect to main page)
	 * @return void
	 */
	function save()
	{
		
		$model = $this->getModel('single');

		if ($model->store($post)) {
			$msg = JText::_( 'Camp Submitted - Please Await Approval!' );
		} else {
			$msg = JText::_( 'Error Submitting Camp' );
		}

		// Check the table in so it can be edited.... we are done with it anyway
		$link = 'index.php?option=com_summercamps';
		$this->setRedirect($link, $msg);
	}
    
 
}